package com.chima.service.impl;
import java.util.List;

import com.chima.dao.DetailJobDao;
import com.chima.domain.DetailJob;
import com.chima.domain.TastJob;
import com.chima.service.DetailJobService;

public class DetailJobServiceImp implements DetailJobService {

	 private DetailJobDao detailJobDao;

	public DetailJobDao getDetailJobDao() {
		return detailJobDao;
	}

	public void setDetailJobDao(DetailJobDao detailJobDao) {
		this.detailJobDao = detailJobDao;
	}

	public DetailJob findDetailJobById(int id) {
	
		return detailJobDao.findById(id);
	}

	public List<DetailJob> findDetailJobByJobId(int Jobid) {
		
		return  detailJobDao.findByJobId(Jobid);
	}

	public void addDetailJob(DetailJob detailJob) {
	
		detailJobDao.addDetailJob(detailJob);
	}

	public void deletDetailJob(int  id) {
		detailJobDao.deleteDetailJob(id);
	}

	public List<DetailJob> findDetailJobByEmpAndState(int emp, String state) {
		
		return detailJobDao.findByEmpAndState(emp, state);
	}

	public void updateDetailJob(DetailJob detailJob) {
		    detailJobDao.updateDetailJob(detailJob);
		
	}

	public void deletDetailJobByJob(int id) {
		List<DetailJob> detailJobs=detailJobDao.findByJobId(id);
		if(detailJobs!=null){
			for(DetailJob d:detailJobs){
				detailJobDao.deleteDetailJob(d.getId());
			}
		}
	}

	public TastJob findTastJobByJobId(int Jobid) {
		
		return detailJobDao.findTastJobByJobId(Jobid);
	}

	public void deletDetailJobByemp(int empid) {
		
		detailJobDao.deletDetailJobByemp(empid);
	}
	 
}
